package com.xxk.rocket.star.core.annotation;

import com.xxk.rocket.star.core.context.AbsProcessContext;
import com.xxk.rocket.star.core.context.ConsumeContext;

import java.lang.reflect.Method;

public abstract class AbsProcessAnnotationConsume<DTO>
        extends AbsProcessContext<DTO>
        implements IProcessAnnotationConsume {

  protected abstract void processConsume(DTO dto, Class aClass, Object o, Method method)
          throws Throwable;

  @Override
  @SuppressWarnings({"unchecked"})
  public void processConsumeByContext(ConsumeContext consumeContext, Class aClass, Object o,
                                      Method method) throws Throwable {
    processConsume((DTO) consumeContext.getDTOOrNew(this), aClass, o, method);
  }

}
